package com.zq.api.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zq.common.core.domain.Result;
import com.zq.common.utils.SecurityUtils;
import com.zq.server.admin.domain.SysActivityNotify;
import com.zq.server.admin.domain.SysNotify;
import com.zq.server.admin.service.ISysActivityNotifyService;
import com.zq.server.admin.service.ISysNotifyService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * SysNotify
 * 
 * @author Super
 * @version 2024/03/26 21:52
 **/
@Api(tags = "统一消息处理")
@RestController
@RequestMapping("/sysNotify")
public class SysNotifyController {

    @Autowired
    private ISysActivityNotifyService notifyService;

    @Autowired
    private ISysNotifyService iSysNotifyService;

    /**
     * 获取当前用户所有消息
     * 
     * @作者 Caige
     * @日期 2024.3.26 21:55
     * @Description //TODO 21:55
     * @return 消息集合
     */
    @GetMapping("getNotifyList")
    @ApiOperation("获取用户所有消息集合")
    public Result<List<SysActivityNotify>> getNotifyList() {
        SysActivityNotify param = new SysActivityNotify();
        param.setTargetId(SecurityUtils.getWechatUserId());
        List<SysActivityNotify> sysActivityNotifies = notifyService.selectNotifyList(param);
        return Result.success(sysActivityNotifies);
    }

    /**
     * 获取当前用户所有消息
     * 
     * @作者 Caige
     * @日期 2024.3.26 21:55
     * @Description //TODO 21:55
     * @return 消息集合
     */
    @GetMapping("getSysNotifyList")
    @ApiOperation("获取用户所有消息集合")
    public Result<List<SysNotify>> getSysNotifyList() {
        SysNotify param = new SysNotify();
        param.setTargetId(SecurityUtils.getWechatUserId());
        List<SysNotify> sysActivityNotifies = iSysNotifyService.selectNotifyList(param);
        return Result.success(sysActivityNotifies);
    }

    /**
     * @author 财哥 &#064; 2024.3.30 16:49
     * @return com.zq.common.core.domain.Result 获取用户未阅读的消息通知
     **/

    @ApiOperation("获取用户未阅读的消息通知")
    @GetMapping("getUnreadMessageCount")
    public Result getUnreadMessageCount() {
        return iSysNotifyService.getUnreadMessageCount();
    }

}
